case class Point(val x :Int, val y :Int)
case class TextView(val name :String, val x :Int, val y :Int, val w :Int, val h:Int) {
	def origin = Pair(x,y)
	def size = Pair(w,h)
}

trait Shape {
	def boundingBox :Pair[Point, Point]
	
	def circumference = {
		val Pair(Point(x1, y1), Point(x2, y2)) = boundingBox
		2*((x2-x1)+(y2-y1))
	} 	
}


case class TextViewShapeAdapter(private val deleg: TextView) extends Shape {
	def boundingBox = {
		val Pair(x,y) = deleg.origin
		val Pair(w,h) = deleg.size
		Pair(Point(x,y), Point(x+w, y+h))		
	}
}

implicit def wrapTextView(tv: TextView): Shape = TextViewShapeAdapter(tv)

object Main extends Deployment {
	def main(args :Array[String]) = System.out.println(TextView("foo", 0, 0, 10, 10).circumference)
}

